package com.xxx.dto;

import java.io.Serializable;

/**
 * 接口返回基类（带业务数据和记录总数量）
 * 
 * 
 * 
 */
public class ResponseListDTO extends ResponseDTO implements Serializable {
	
	private static final long serialVersionUID = 8209685434938822564L;
	
	private long totalNum;

	public ResponseListDTO(int code, String msg, Object data, long totalNum) {
		super(code, msg, data);
		this.totalNum = totalNum;
	}

	public long getTotalNum() {
		return totalNum;
	}

	public void setTotalNum(long totalNum) {
		this.totalNum = totalNum;
	}

	public static ResponseListDTO builtSuccess() {
		return builtSuccess(null, 0);
	}

	public static ResponseListDTO builtSuccess(Object data, long totalNum) {
		return new ResponseListDTO(SUCCESS, SUCCESS_MSG, data, totalNum);
	}

	public static ResponseListDTO builtSuccess(String msg, Object data, long totalNum) {
		return new ResponseListDTO(SUCCESS, msg, data, totalNum);
	}

	public static ResponseListDTO builtFail(String msg) {
		return new ResponseListDTO(FAILD, msg, null, 0);
	}

	public static ResponseListDTO builtFail(int code, String msg) {
		return new ResponseListDTO(code, msg, null, 0);
	}

	public static ResponseListDTO builtException() {
		return new ResponseListDTO(EXCEPTION, EXCEPTION_MSG, null, 0);
	}
}
